//
//  CellForMatch.m
//  MY Project For Sport
//
//  Created by dllo on 16/1/22.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "CellForMatch.h"
#import "ModelForMatch.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <DKNightVersion.h>
#import "UIColor+Wonderful.h"
#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface CellForMatch  ()

@property (nonatomic, retain) UILabel *labelForTitle;
@property (nonatomic, retain) UIImageView *imageView;


@end

@implementation CellForMatch

- (void)dealloc {
    [_labelForTitle release];
    [_imageView release];
    
    [super dealloc];

}

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];

    if (self) {
        
        self.contentView.dk_backgroundColorPicker = DKColorWithColors([UIColor linenColor], [UIColor lightGrayColor]);
        
        
        self.labelForTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelForTitle];
        [_labelForTitle release];
        self.labelForTitle.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        
        
        self.imageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageView];
        [_imageView release];
        
    }

    return self;
    
}

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {

    self.imageView.frame = CGRectMake(0, 0, self.contentView.frame.size.width / 1.9, self.contentView.frame.size.height / 1.9);
    self.imageView.center = self.contentView.center;

    self.labelForTitle.frame = CGRectMake(self.contentView.frame.size.width / 5.5, self.frame.size.width / 1.3, self.contentView.frame.size.width / 1.4, self.contentView.frame.size.height / 4.48);
    self.labelForTitle.textAlignment = NSTextAlignmentCenter;
   // self.labelForTitle.backgroundColor = [UIColor redColor];
}

-(void)passModelForMacth:(ModelForMatch *)model {

    [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.logo]];
    self.labelForTitle.text = model.title;

}
@end
